package com.ag.lwc.action;

import java.util.Date;

import com.ag.common.BaseAction;
import com.ag.zhh.service.ContactLogService;
/**
 * 保存通话日志的action
 * @author user
 *
 */
public class SaveCallLogAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2984221482433475091L;
	private String caller;	//主叫
	private String called;	//被叫
	private String filename;	//录音文件名
	private static Date startTime;	//开始时间
	private Date endTime;		//结束时间
	private ContactLogService contactLogService;
	private String message;
	public String execute()
	{
		endTime = new Date();
		System.out.println("保存通话日志: caller: "+caller+" called:"+called+" filename:"+filename+" startTime:"+startTime+" endTime:"+endTime);
		contactLogService.addPhoneContactLog(startTime, endTime, caller, called, filename);
		message = "saveContactLogSuccess";
		startTime = null;						//清空通话开始时间
		return "saveContactLog";
	}
	/**
	 * 建立通话的开始时间，收到录音文件时执行
	 * @return
	 */
	public String establishTime()
	{
		startTime = new Date();
		System.out.println("通话开始时间："+this.startTime);
		message="startTime";
		return "startTime";
	}
	public String getCaller() {
		return caller;
	}
	public void setCaller(String caller) {
		this.caller = caller;
	}
	public String getCalled() {
		return called;
	}
	public void setCalled(String called) {
		this.called = called;
	}
	public String getFilename() {
		return filename;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		System.out.println("进到action啦  	startTime:"+startTime);
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public ContactLogService getContactLogService() {
		return contactLogService;
	}
	public void setContactLogService(ContactLogService contactLogService) {
		this.contactLogService = contactLogService;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

}
